﻿namespace Tentacle.Downloader
{
    using System;
    using Tentacle.Core;

    public interface IDownloader
    {
        /// <summary>
        /// 设置当前下载器的任务
        /// </summary>
        /// <param name="request"></param>
        bool SetTask(WebRequest request);

        /// <summary>
        /// 获取下载延迟
        /// </summary>
        int ElapseTime { get;}

        /// <summary>
        /// 
        /// </summary>
        int WaitTime { get; set; }

        /// <summary>
        /// 获取最后一次完成任务的时间
        /// </summary>
        DateTime LastTime { get;}

        /// <summary>
        /// 
        /// </summary>
        bool CanDownload { get; }

        /// <summary>
        /// 任务下载完成时触发
        /// </summary>
        event DownloadCompletedHandler DownloadCompleted;

        /// <summary>
        /// 
        /// </summary>
        event DownloadFailedHandler DownloadFailed;
    }
}
